package com.example.courseorder.service;

import com.example.courseorder.domain.User;
import com.example.courseorder.repository.UserRepository;
import com.example.courseorder.repository.impl.LoginDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class LoginService implements LoginDao {
    @Resource
    private UserRepository userRepository;

    @Override
    public User getUser(String name, String password) {
        System.out.println("登录校验");
        return userRepository.getByPasswordAndUsername(name,password);
    }

    @Override
    public void insertUser(User user) {
        System.out.println("保存");
        userRepository.save(user);
    }
}
